package com.sleepingcat.flutter_boost_dart.platform_view

import android.content.Context
import android.util.Log
import android.view.View
import android.widget.TextView
import io.flutter.embedding.engine.plugins.FlutterPlugin
import io.flutter.plugin.platform.PlatformView

/**
 * @作者 志浩
 * @时间 2025/10/3 12:32
 * @描述 TODO
 */
class NativeTextView(context: Context, id: Int, creationParams: Map<String, Any>?, binding: FlutterPlugin.FlutterPluginBinding) : PlatformView {
    private val TAG = "NativeTextView"
    private var textView: TextView = TextView(context)

    init {
        creationParams?.let {
            val orDefault = it.getOrDefault("text", "没有传值")
            textView.text = orDefault.toString()
        }
        // 利用binding注册pigeon通道，处理flutter转过来的命令
    }

    override fun getView(): View {
        Log.d("cat","NativeTextView getView")
        return textView
    }

    override fun dispose() {
        Log.d("cat","NativeTextView dispose")
        // 注销掉上面的通道
    }
}